<template>
	<view>
		<uni-section title="表单校验" type="line">
			<view class="example">
				<!-- 基础表单校验 -->
				<!-- <uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData">
					<uni-forms-item label="用户名" required name="username">
						<uni-easyinput v-model="valiFormData.username" placeholder="请输入用户名" />
					</uni-forms-item>
					<uni-forms-item label="密码" required name="password">
						<uni-easyinput v-model="valiFormData.password" placeholder="请输入密码" />
					</uni-forms-item>
					<uni-forms-item label="自我介绍" name="introduction">
						<uni-easyinput type="textarea" v-model="valiFormData.introduction" placeholder="请输入自我介绍" />
					</uni-forms-item>
				</uni-forms> -->
				<view class="">
					<span>用户名</span>
					<input type="text" name="username" v-model="loginInfo.username" />
				</view>
				<view class="">
					<span>密码</span>
					<input type="text" name="password" v-model="loginInfo.password" />
				</view>
				<button type="primary" @click="loginByInfo">提交</button>
			</view>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loginInfo: {
					username: '',
					password: '',
					introduction: ''
				},
				rules: [],
				valiFormData: [],
			}
		},
		methods: {
			submit(formName) {
				console.log(formName);	
			},
			async loginByInfo() {
				const res = await uniCloud.callFunction({
					name: 'login',
					data: {
						username: this.loginInfo.username,
						password: this.loginInfo.password
					}
				})
			}
		}
	}
</script>

<style>

</style>
